﻿var grid, cbProgress;

//初始化表格
function InitGrid() {
    var txtDBBCBATCHNO = $('#txtDBBCBATCHNO').val();
    var startDate = $('#StartDate').datebox('getValue');
    var endDate = $('#EndDate').datebox('getValue');
    var seedtype = $('#selDBoxType').combobox('getValue');
    grid = $('#tab_list').datagrid({
        name: 'tbl_data',
        url: '/DeliveryBox/InitJsonResult',
        title: '配送箱编号列表',
        queryParams: {
            dbbcBatchNo: txtDBBCBATCHNO,
            startDate: startDate,
            endDate: endDate,
            seedType: seedtype
        },
        height: 700,
        fitColumns: false,
        rownumbers: true,
        singleSelect: true,
        idField: 'ID',
        columns: [[
                    { field: 'ID', title: '序号', hidden: true, width: 100 },
                    { field: 'DBBCBATCHNO', title: '生成批次号', align: 'center', sortable: true, width: 200 },
                    { field: 'DBBCCODE', title: '箱号', align: 'center', sortable: true, width: 200 },
                    { field: 'OPRNO', title: '操作人', align: 'center', sortable: true, width: 200 },
                    { field: 'CREATETIME', title: '时间', align: 'center', sortable: true, width: 200 },
        ]],
        toolbar: "",
        pagination: false,
        pageSize: 20,
        pageNumber: 1,
        pageList: [10, 20, 30, 40, 50],
        rownumbers: true, //行号
        onLoadSuccess: function (data) {
            onRefreshButton();
        },
        onSelect: function (rowIndex, rowData) {
            onRefreshButton();
        },
        onUnselect: function (rowIndex, rowData) {
            onRefreshButton();
        },
        onSortColumn: function (sort, order) {
            grid.datagrid('reload');
        }
    });
};